package com.bdsoft.service.impl;

import java.util.List;
import java.util.Map;

import com.bdsoft.beanconfig.TokenService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bdsoft.mapper.QmsQuestionMapper;
import com.bdsoft.domain.QmsQuestion;
import com.bdsoft.service.IQmsQuestionService;

/**
 * 问题服务Service业务层处理
 * 
 * @author dumingshen
 * @date 2025-10-29
 */
@Service
public class QmsQuestionServiceImpl implements IQmsQuestionService 
{
    @Autowired
    private QmsQuestionMapper qmsQuestionMapper;
    @Autowired
    private TokenService tokenService;

    /**
     * 查询问题服务
     * 
     * @param id 问题服务主键
     * @return 问题服务
     */
    @Override
    public QmsQuestion selectQmsQuestionById(String username,Long id)
    {

        qmsQuestionMapper.InsertHistory(username,id);


        return qmsQuestionMapper.selectQmsQuestionById(id);
    }

    @Override
    public List<Map<String, Object>> QueHistory(String username) {
        return qmsQuestionMapper.QueHistory(username);
    }


    /**
     * 查询问题服务列表
     * 
     * @param qmsQuestion 问题服务
     * @return 问题服务
     */
    @Override
    public List<QmsQuestion> selectQmsQuestionList(QmsQuestion qmsQuestion)
    {
        return qmsQuestionMapper.selectQmsQuestionList(qmsQuestion);
    }

    @Override
    public List<Map<String, Object>> selectQueList(Map<String, Object> params) {

        return qmsQuestionMapper.selectQueList(params);
    }

    /**
     * 新增问题服务
     * 
     * @param qmsQuestion 问题服务
     * @return 结果
     */
    @Override
    public int insertQmsQuestion(QmsQuestion qmsQuestion)
    {
        qmsQuestion.setCreateTime(DateUtils.getNowDate());
        return qmsQuestionMapper.insertQmsQuestion(qmsQuestion);
    }

    /**
     * 修改问题服务
     * 
     * @param qmsQuestion 问题服务
     * @return 结果
     */
    @Override
    public int updateQmsQuestion(QmsQuestion qmsQuestion)
    {
        qmsQuestion.setUpdateTime(DateUtils.getNowDate());
        return qmsQuestionMapper.updateQmsQuestion(qmsQuestion);
    }

    /**
     * 批量删除问题服务
     * 
     * @param ids 需要删除的问题服务主键
     * @return 结果
     */
    @Override
    public int deleteQmsQuestionByIds(Long[] ids)
    {
        return qmsQuestionMapper.deleteQmsQuestionByIds(ids);
    }

    /**
     * 删除问题服务信息
     * 
     * @param id 问题服务主键
     * @return 结果
     */
    @Override
    public int deleteQmsQuestionById(Long id)
    {
        return qmsQuestionMapper.deleteQmsQuestionById(id);
    }
}
